
#ifndef CACHECONTROLLER_HPP
#define CACHECONTROLLER_HPP

#include <map>
#include <string>

#include "CacheController.hpp"
#include "CacheEntry.hpp"
#include "http/HttpRequest.hpp"
#include "io/Context.hpp"
#include "pthread/Mutex.hpp"
class CacheController {
private:

	std::map<std::string, CacheEntry*> cacheEntries;
	std::map<CacheEntry*, std::string> cacheEntriesMap;
	CacheController(){}
	CacheController(const CacheController& controller);
	CacheController& operator=(const CacheController& controller);
	Mutex mutex;
public:
	// TODO: threadsafe
	static CacheController& getInstance() {
		static CacheController instance;
		return instance;
	}

	CacheEntry * get(Context & context, HttpRequest request);
	void remove(CacheEntry * entry);

};

#endif /* CACHECONTROLLER_HPP */
